////////////////////////////////////////
// 				Information			  //
////////////////////////////////////////

// Investor Memory (Katrin Gödker, Peiran Jiao, Paul Smeets)
// Replication code for results from Experiment 3

////////////////////////////////////////
// 				Settings			  //
////////////////////////////////////////

// Stata settings:
version 15

// Import file: Use Data_Experiment3.dta

////////////////////////////////////////
// 				Dataset 			  //
////////////////////////////////////////

// Unique subject IDs are generated for clarity, pseudonymized Prolific IDs are deleted.

// Treatment variable
// Groups: 11=control (with reminder), 12=delay
gen Treatment = .
replace Treatment = 0 if participantgroup == 11
replace Treatment = 1 if participantgroup == 12

// Memory bias
gen MemoryBiasPos = recall_positiv - true_positives

// Objective Bayesian Posterior that the stock is of the good type
gen Prob100 = Bayesian_posterior*100

*rename survey_11playerBayesian_poste BayesianPosterior

// Points bet
rename playerbet PointsBet

// Variable names for table
label variable MemoryBiasPos "Memory Bias (Pos. Out.)"
label variable Treatment "Treatment (Delay)"

////////////////////////////////////////
// 				Analyses 			  //
////////////////////////////////////////

// FIGURE 4
cibar PointsBet if Prob100 < 50, over1 (Treatment) level(95) graphopts(title("Betting") legend(off) xlabel(1 "Immediate" 2 "Delay") ytitle("Points bet") ) baropts(fcolor(gs14) lcolor(black) lwidth(0.3))

// TABLE 5
eststo clear
eststo: xi: reg PointsBet Treatment
eststo: xi: reg PointsBet Treatment if Prob100 < 50
eststo: xi: reg PointsBet MemoryBiasPos if Prob100 < 50
esttab using reg_confidence.tex,  ///
star(* 0.10 ** 0.05 *** 0.01)  b(3) se(2) label mtitles("Points Bet" "Points Bet (Subopt.)" "Points Bet (Subopt.)")  ///
replace stats(N r2,  fmt(%12.0fc %12.2fc) labels("N" "$ R^2 $")) order(Treatment MemoryBiasPos) drop() nogaps tex prehead(`"{"' \begin{scriptsize} `"\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}"' \begin{tabular}{l*{@E}{l}} \toprule) posthead("\midrule") prefoot("\midrule") postfoot(`"\bottomrule"'  \end{tabular} \end{scriptsize} }) 
